package com.autosalon.model;

import java.io.Serializable;
import java.sql.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "FINANCOVANI")
public class Financovani implements Serializable, IModelClass{
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = "AKTUALNE_ZAPLACENO", nullable = false)
	private int aktualneZaplaceno;
	
	@Column(name = "POC_FINANCOVANI", nullable = false)
	private Date pocFinancovani;
	
	@Column(name = "DATUM_SPLATNOSTI", nullable = false)
	private Date datumSplatnosti;
	
	@ManyToOne(cascade= {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name = "ID_STAV_FINANCOVANI")
	private StavFinancovani stavyFinancovani;
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name="ID_FINANCOVANI")
	private List<Objednavka> objednavky;
	
	@OneToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name="ID_PUJCKY", nullable=true)
	private Pujcka pujcka;

	@Override
	public Long getId() {
		return id;
	}

	public int getAktualneZaplaceno() {
		return aktualneZaplaceno;
	}

	public void setAktualneZaplaceno(int aktualneZaplaceno) {
		this.aktualneZaplaceno = aktualneZaplaceno;
	}

	public Date getPocFinancovani() {
		return pocFinancovani;
	}

	public void setPocFinancovani(Date pocFinancovani) {
		this.pocFinancovani = pocFinancovani;
	}

	public Date getDatumSplatnosti() {
		return datumSplatnosti;
	}

	public void setDatumSplatnosti(Date datumSplatnosti) {
		this.datumSplatnosti = datumSplatnosti;
	}

	public StavFinancovani getStavyFinancovani() {
		return stavyFinancovani;
	}

	public void setStavyFinancovani(StavFinancovani stavyFinancovani) {
		this.stavyFinancovani = stavyFinancovani;
	}

	public List<Objednavka> getObjednavky() {
		return objednavky;
	}

	public void setObjednavky(List<Objednavka> objednavky) {
		this.objednavky = objednavky;
	}

	public Pujcka getPujcka() {
		return pujcka;
	}

	public void setPujcka(Pujcka pujcka) {
		this.pujcka = pujcka;
	}

	
	

}
